
<div class="categories index">
	<h2><?php echo  'Categories'; ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo 'id'; ?></th>
			<th><?php echo 'user_id'; ?></th>
			<th><?php echo 'name'; ?></th>
			<th><?php echo 'description'; ?></th>
			<th><?php echo 'parent_id'; ?></th>
			<th><?php echo 'type'; ?></th>
			<th><?php echo 'status'; ?></th>
			<th class="actions"><?php echo __('Actions'); ?></th>
	</tr>
	<?php foreach ($categories as $category): ?>
	<tr>
            <td class="ca_id"><?php echo $category->id; ?>&nbsp;</td>
		<td>
			<?php  echo Html::anchor('users/view/'.$category->user_id,$category->user_id);?>
		</td>
		<td><?php echo $category->name;?>&nbsp;</td>
		<td><?php echo $category->description; ?>&nbsp;</td>
                <td><?php echo $category->parent_id; ?>&nbsp;</td>
                <td><?php if ($category['Category']['type'] == 0)
                {
                    echo "Earn";
                } else
                {
                    echo "Spent";
                } ?>&nbsp;</td>
                <td><?php
                    If ($category['Category']['status'] == 0)
                    {
                        echo "notdefault";
                    }
                    If ($category['Category']['status'] == 1)
                    {
                        echo "default";
                    }
                    ?>&nbsp;</td>
		<td class="actions">
			<?php echo Html::anchor('categories/view/'.$category->id,'View');?>
			<?php echo Html::anchor('categories/edit/'.$category->id,'Edit');?>
			<?php 
                        if( $category->user_id== Session::get('userid'))
                        {
                        echo Html::anchor("categories/delete/".$category->id,"Delete", array("onClick " =>" javascript:return confirm('Are you sure delete ?') ")); 
                        
                        }?>
                </td>
	</tr>
<?php endforeach; ?>
	</table>
	<div class="paging">
	<p>
	<?php
                echo Pagination::instance('mypagination')->pages_render();
                echo Pagination::instance('mypagination')->previous();
                echo Pagination::instance('mypagination')->next();
	?>	</p>
	</div>
</div>
<div class="actions">
	<h3><?php // echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo Html::anchor('categories/add/','New category'); ?></li>
		
	</ul>
</div>
